//引入文章集合
const {Article}=require('../../model/article');
//引入评论模块
const {Comment}=require('../../model/comment');
module.exports=async (req,res)=>{
    //接收客户端传过来的id
    const id=req.query.id;
    //根据id查询文章详情信息
    let article=await Article.findOne({_id:id}).populate('author');
    article = JSON.stringify(article);
    article = JSON.parse(article);
    //查询出来评论信息
    let comment=await Comment.find({aid:id}).populate('uid');
    comment = JSON.stringify(comment);
    comment = JSON.parse(comment);
     //博客详情页面
     res.render('home/article.art',{
        article:article,
        comment:comment
     });
}